<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <link rel="stylesheet" type="text/css" href="__PUBLIC__/static/home/css/weui.css">
        <link rel="stylesheet" type="text/css" href="__PUBLIC__/static/home/css/example.css">
        <script type="text/javascript" src="__PUBLIC__/static/home/js/jquery.min.js"></script>
        <title>去帮忙内容</title>
    </head>
    <body>
        {volist id="v" name="userdata"}
    <div class="page__hd">
        <h1 class="page__title">{$v.title}</h1>
        <p class="page__desc">{$v.name}</p>
    </div>
    <div class="weui-form-preview">

            <div class="weui-form-preview__hd">
                <label class="weui-form-preview__label">奖励</label>
                <em class="weui-form-preview__value">{$v.reward}</em>
            </div>
            <div class="weui-form-preview__bd">
                <div class="weui-form-preview__item">
                    <label class="weui-form-preview__label">标题</label>
                    <span class="weui-form-preview__value">{$v.title}</span>
                </div>
                <div class="weui-form-preview__item">
                    <label class="weui-form-preview__label">发布时间</label>
                    <span class="weui-form-preview__value">{$v.date} {$v.time}</span>
                </div>
                <div class="weui-form-preview__item">
                    <label class="weui-form-preview__label">截止时间</label>
                    <span class="weui-form-preview__value">{$v.outdate} {$v.outtime}</span>
                </div>
                <div class="weui-form-preview__item">
                    <label class="weui-form-preview__label">位置</label>
                    <span class="weui-form-preview__value">{$v.place}</span>
                </div>
                <div class="weui-form-preview__item">
                    <label class="weui-form-preview__label">内容</label>
                    <span class="weui-form-preview__value">{$v.content}</span>
                </div>
            </div>
            <div class="weui-form-preview__ft">
                <a class="weui-form-preview__btn weui-form-preview__btn_default" href="javascript:history.back(-1);">返回</a>
                <a style="color:#0099CC" class="weui-form-preview__btn weui-form-preview__btn_primary" onclick="add({$v.help_id},{$v.userid})" href="javascript:;" >接单</a>
            </div>

        </div>
                {/volist}

<script type="text/javascript">


    function Alert(massage){
          var toastdiv = "<div class='weui-toast'><i class='weui-icon-success-no-circle weui-icon_toast'></i><p class='weui-toast__content'>"+massage+"</p></div>";

          $(document.body).append(toastdiv);

          $(".weui-toast").fadeIn(function(){
            $(".weui-toast").fadeOut(2000,function(){
              $(".weui-toast").remove();
            });
          });     
    }

    function add(help_id,userid)
    {
        $.post("{:url('Helpcontent/addlist')}", {help_id:help_id,userid:userid}, function(data) {
            if(data.code==1)
            {
                Alert(data.message);
                window.location.href="{:url('Helpcontent/index')}";
            }
            else
                Alert(data.message);
        });
    }


    </script>
    </body>

</html>